package com.polytech.ihm;

import java.awt.Dimension;
import java.awt.FlowLayout;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class FrameAddCar extends JFrame{


	private LabeledTextField fieldPlaque=new LabeledTextField("Plaque :", 10, 100);
	private LabeledTextField fieldState=new LabeledTextField("State :", 12, 100);
	private LabeledTextField fieldKm=new LabeledTextField("Km :", 12, 100);
	private LabeledTextField fieldPrice=new LabeledTextField("Price :", 8, 100);
	private JLabel labelBrand=new JLabel("Brand : ");
	private JLabel labelModel=new JLabel("Model : ");
	private JLabel labelColor=new JLabel("Color : ");
	private JLabel labelCategory=new JLabel("Category:");
	private JComboBox<String> comboBrand=new JComboBox<>();
	private JComboBox<String> comboColor=new JComboBox<>();
	private JComboBox<String> comboModel=new JComboBox<>();
	private JComboBox<String> comboCategory=new JComboBox<>();
	private JPanel panBrand=new JPanel(new FlowLayout(FlowLayout.LEFT));
	private JPanel panCategory=new JPanel(new FlowLayout(FlowLayout.LEFT));
	private JPanel panModel=new JPanel(new FlowLayout(FlowLayout.LEFT));
	private JPanel panColor=new JPanel(new FlowLayout(FlowLayout.LEFT));
	private JPanel panContainer=new JPanel();
	private JButton buttonAdd=new JButton("Add");
	private JPanel panButtons=new JPanel(new FlowLayout(FlowLayout.RIGHT));
	private JPanel pan=new JPanel(new FlowLayout(FlowLayout.LEFT));




	public FrameAddCar() {
		panContainer.setLayout(new BoxLayout(panContainer, BoxLayout.Y_AXIS));
		
		labelBrand.setPreferredSize(new Dimension(100, 20));
		labelColor.setPreferredSize(new Dimension(100, 20));
		labelModel.setPreferredSize(new Dimension(100, 20));
		labelCategory.setPreferredSize(new Dimension(100, 20));
		
		
		
		
		panColor.add(labelColor);
		panColor.add(comboColor);
		comboColor.addItem("Red");
		comboColor.setPreferredSize(new Dimension(140, 20));
		
		panBrand.add(labelBrand);
		panBrand.add(comboBrand);
		comboBrand.addItem("Renaut");
		comboBrand.setPreferredSize(new Dimension(140, 20));
		panModel.add(labelModel);
		panModel.add(comboModel);
		comboModel.setPreferredSize(new Dimension(140, 20));
		
		panCategory.add(labelCategory);
		panCategory.add(comboCategory);
		comboCategory.setPreferredSize(new Dimension(140, 20));
		
		panContainer.add(fieldPlaque);
		panContainer.add(fieldState);
		panContainer.add(fieldKm);
		panContainer.add(fieldPrice);
		panContainer.add(panColor);
		panContainer.add(panModel);
		panContainer.add(panBrand);
		panContainer.add(panCategory);
		panButtons.add(buttonAdd);
		panContainer.add(panButtons);
		pan.add(panContainer);
		this.setContentPane(pan);
		this.setVisible(true);
		this.pack();
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	
		

	}

}
